import { Space } from 'antd';
import { MaterialCategorySvgComponent } from '../../icons';
import { getMaterialConfig } from '../common/MetalIconMapping';

// 材料树结构常量
const metalKeys = [
  'metal-aisi_304',
  'metal-aisi_1045',
  'metal-brass',
  'metal-gold',
  'metal-aluminum',
  'metal-aluminum_2024',
  'metal-aluminum_7075',
  'metal-ti_5ai_25sn',
  'metal-iron',
  'metal-copper',
  'metal-silver',
];
const nonMetalKeys = [
  'nonmetal-abs',
  'nonmetal-glass',
  'nonmetal-rubber',
  'nonmetal-pine_wood',
];
const customKeys = ['custom-powercad-styles'];

const materialTreeData = [
  {
    label: (
      <Space>
        <MaterialCategorySvgComponent style={{ width: 16, height: 16 }} />

        <span>金属</span>
      </Space>
    ),
    key: 'metal',
    children: metalKeys.map((key) => {
      const Icon = getMaterialConfig(key).icon;
      return {
        label: (
          <Space>
            {Icon ? <Icon style={{ width: 16, height: 16 }} /> : null}
            <span>{getMaterialConfig(key).label}</span>
          </Space>
        ),
        key,
      };
    }),
  },
  {
    key: 'non_metal',
    label: (
      <Space>
        <MaterialCategorySvgComponent style={{ width: 16, height: 16 }} />
        <span>非金属</span>
      </Space>
    ),
    children: nonMetalKeys.map((key) => {
      const Icon = getMaterialConfig(key).icon;
      return {
        label: (
          <Space>
            {Icon ? <Icon style={{ width: 16, height: 16 }} /> : null}
            <span>{getMaterialConfig(key).label}</span>
          </Space>
        ),
        key,
      };
    }),
  },
  {
    label: (
      <Space size='small'>
        <MaterialCategorySvgComponent style={{ width: 16, height: 16 }} />
        <span>其他</span>
      </Space>
    ),
    key: 'custom',
    children: customKeys.map((key) => {
      const Icon = getMaterialConfig(key).icon;
      return {
        label: (
          <Space>
            {Icon ? <Icon style={{ width: 16, height: 16 }} /> : null}
            <span>{getMaterialConfig(key).label}</span>
          </Space>
        ),
        key,
      };
    }),
  },
];

export default materialTreeData;
